﻿using System;
using System.Windows.Forms;
using System.Xml;

namespace FogBugz {
	public partial class ConfirmationForm : Form {
		string id = "";
		string url = "";
		public ConfirmationForm(string url, string result) {
			InitializeComponent();
			XmlDocument res = new XmlDocument();
			res.LoadXml(result);
			try {
				this.url = url;
				id = res.SelectSingleNode("response/case").Attributes["ixBug"].InnerText;
				lblCase.Text += id;
			} catch(Exception e) {
				System.Diagnostics.Debug.WriteLine("Error getting case id: " + e.Message);
			}
		}

		private void btnOpen_Click(object sender, EventArgs e) {
			url += "/default.asp?" + id;
			System.Diagnostics.Process.Start(url);
			DialogResult = System.Windows.Forms.DialogResult.OK;
			Close();
		}

		private void btnOK_Click(object sender, EventArgs e) {
			Close();
		}
	}
}
